package com.piggy.im.service;

import com.piggy.im.domain.bo.SysPublishMsgBo;
import com.piggy.im.mq.model.StationMsgMQ;
import com.piggy.mq.vender.IMQSender;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

@Configuration
public class StationMsgSend {

    private static IMQSender sender;

    @Resource
    public void setIMQSender(IMQSender mqSender) {
        sender = mqSender;
    }

    @Bean
    public StationMsgSend stationMsgSend() {
        return new StationMsgSend();
    }

    public static void send(SysPublishMsgBo payload) {
        sender.send(new StationMsgMQ(payload));
    }

}
